import { cached } from '@/utils'
import { getEnumDict, ENUM_MAP } from './enumDict'

export async function getStockStatus() {
  const { data } = await getEnumDict(ENUM_MAP.stockStatus)
  return data
}

const tags = {
  '-1': 'warning',
  0: 'primary',
  2: 'info',
  3: 'danger'
}

export const stockStatusTag = cached(val => tags[val])

